/**!
\copyright  Copyright (c) 2023-2024 Qualcomm Technologies International, Ltd.
            All Rights Reserved.
            Qualcomm Technologies International, Ltd. Confidential and Proprietary.
\file
\brief      Context types exposed by the context framework
\addtogroup context_framework
@{
**/

#ifndef CONTEXT_TYPES_H_
#define CONTEXT_TYPES_H_

#include <device.h>
#include "source_param_types.h"
#include "ui_indicator.h"
#include "audio_a2dp_types.h"

/*! \brief Range of states for this device. Allows Context Framework to share specific data. */
typedef enum
{
    context_physical_state,
    context_maximum_connected_handsets,
    context_connected_handsets_info,
    context_active_source_info,
    context_streaming_info,
    context_audio_volume_info,
    context_spatial_audio_info,
    context_ui_info,
    context_eft,
    max_context_items,
} context_item_t;

/*! \brief Physical state of this device. */
typedef enum
{
    in_case,
    out_of_case,
    on_head,
} context_physical_state_t;

typedef unsigned context_maximum_connected_handsets_t;

/*! \brief Handset info including bluetooth connection type. */
typedef struct
{
    device_t handset;
    bool is_bredr_connected;
    bool is_le_connected;
} connected_handset_info_t;

#define CONTEXT_INFO_MAX_HANDSETS     4

/*! \brief Connected handsets information. */
typedef struct
{
    unsigned number_of_connected_handsets;
    connected_handset_info_t connected_handsets[CONTEXT_INFO_MAX_HANDSETS];
} context_connected_handsets_info_t;

/*! \brief Active control source information. */
typedef struct
{
    device_t handset;
    generic_source_t active_source;
    bool has_control_channel;
} context_active_source_info_t;

/*! \brief Active source volume information. */
typedef struct
{
    uint8 active_source_volume_percent;
} context_active_source_volume_info_t;

/*! \brief Streaming information sources. */
typedef enum {
    CONTEXT_STREAMING_STATISTICS_TYPE_LEA,
    CONTEXT_STREAMING_STATISTICS_TYPE_A2DP,
	CONTEXT_STREAMING_STATISTICS_TYPE_RESERVED
} context_streaming_statistic_type;

/*! \brief Common streaming information between all sources. */
typedef struct {
    uint32_t bitrate;
    int16_t primary_rssi;
    bool is_lossless;
    bool is_adaptive;
} context_streaming_statistics_common_t;

/*! \brief Streaming information specific to LEA. */
typedef struct  {
    uint8_t codec_type;
} context_streaming_statistics_lea_t;

/*! \brief Streaming information specific to A2DP. */
typedef struct  {
    uint8_t seid;
    uint16_t primary_link_quality;
    audio_a2dp_ttp_toa_delta_histogram_t ttp_histogram;
    uint32 seqn_errors;
} context_streaming_statistics_a2dp_t;


/*! \brief Streaming information aggregate. */
typedef struct
{
    context_streaming_statistics_common_t common;
    context_streaming_statistic_type type;
    union
    {
        context_streaming_statistics_lea_t lea;
        context_streaming_statistics_a2dp_t a2dp;
    } u;
} context_streaming_info_t;

/*! \brief ui source information. */
typedef struct
{
    ui_indication_t ui_provider_info;
} context_ui_info_t;

/*! \brief Eartp Fit Test information */
typedef struct
{
    bool eft_active;

} context_eft_t;

#endif /* CONTEXT_TYPES_H_ */
/*! @} !*/